<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="generator" content="AsciiDoc 8.6.8" />
<link rel="Shortcut Icon" href="/images/favicon.ico" type="image/x-icon" />
<title></title>
<link rel="stylesheet" href="asciidoc-1.css" tppabs="http://old.peachfuzzer.com/v3/asciidoc.css" type="text/css" />
<link rel="stylesheet" href="website-1.css" tppabs="http://old.peachfuzzer.com/v3/website.css" type="text/css" />
</head>

<body>

<div id="layout-menu-box">
<div id="layout-menu">
  <div><a href="WhatIsPeach.html" tppabs="http://old.peachfuzzer.com/WhatIsPeach.html">What is Peach</a></div>
  <div><a href="Installation.html" tppabs="http://old.peachfuzzer.com/v3/Installation.html"><b>Installing</b></a></div>
  <div><a href="PeachQuickStart.html" tppabs="http://old.peachfuzzer.com/v3/PeachQuickStart.html"><b>Tutorials</b></a></div>
  <div><a href="Methodology.html" tppabs="http://old.peachfuzzer.com/Methodology.html">Methodology</a></div>
  <div><a href="Introduction.html" tppabs="http://old.peachfuzzer.com/Introduction.html">Introduction</a></div>
  <div><a href="Training.html" tppabs="http://old.peachfuzzer.com/Training.html">Training</a></div>
  <div><a href="javascript:if(confirm(%27http://www.dejavusecurity.com/peach.html  \n\nThis file was not retrieved by Teleport Ultra, because it is addressed on a domain or path outside the boundaries set for its Starting Address.  \n\nDo you want to open it from the server?%27))window.location=%27http://www.dejavusecurity.com/peach.html%27" tppabs="http://www.dejavusecurity.com/peach.html">Enterprise</a></div>
  <div><a href="FAQ.html" tppabs="http://old.peachfuzzer.com/v3/FAQ.html">FAQ</a></div>
  <div><a href="javascript:if(confirm(%27http://forums.peachfuzzer.com/forum.php  \n\nThis file was not retrieved by Teleport Ultra, because it is addressed on a domain or path outside the boundaries set for its Starting Address.  \n\nDo you want to open it from the server?%27))window.location=%27http://forums.peachfuzzer.com/forum.php%27" tppabs="http://forums.peachfuzzer.com/forum.php">Support Forums</a></div>

  <div><h5>Peach 3</h5></div>
  <div><img src="1.gif" tppabs="http://old.peachfuzzer.com/images/1.gif" /><a href="PeachPit.html" tppabs="http://old.peachfuzzer.com/v3/PeachPit.html">Peach Pits</a></div>
  <div>&nbsp;<img src="1.gif" tppabs="http://old.peachfuzzer.com/images/1.gif" /><a href="GeneralConfiguration.html" tppabs="http://old.peachfuzzer.com/v3/GeneralConfiguration.html">General Conf</a></div>
  <div>&nbsp;<img src="1.gif" tppabs="http://old.peachfuzzer.com/images/1.gif" /><a href="DataModeling.html" tppabs="http://old.peachfuzzer.com/v3/DataModeling.html">Data Modeling</a></div>
  <div>&nbsp;<img src="1.gif" tppabs="http://old.peachfuzzer.com/images/1.gif" /><a href="StateModel.html" tppabs="http://old.peachfuzzer.com/v3/StateModel.html">State Modeling</a></div>
  <div>&nbsp;<img src="1.gif" tppabs="http://old.peachfuzzer.com/images/1.gif" /><a href="AgentsMonitors.html" tppabs="http://old.peachfuzzer.com/v3/AgentsMonitors.html">Agents</a></div>
  <div>&nbsp;&nbsp;<img src="1.gif" tppabs="http://old.peachfuzzer.com/images/1.gif" /><img src="1.gif" tppabs="http://old.peachfuzzer.com/images/1.gif" /><a href="AgentsMonitors.html" tppabs="http://old.peachfuzzer.com/v3/AgentsMonitors.html">Monitors</a></div>
  <div>&nbsp;<img src="1.gif" tppabs="http://old.peachfuzzer.com/images/1.gif" /><a href="TestConfig.html" tppabs="http://old.peachfuzzer.com/v3/TestConfig.html">Test</a></div>
        <div>&nbsp;&nbsp;<img src="1.gif" tppabs="http://old.peachfuzzer.com/images/1.gif" /><img src="1.gif" tppabs="http://old.peachfuzzer.com/images/1.gif" /><a href="Publisher.html" tppabs="http://old.peachfuzzer.com/v3/Publisher.html">Publishers</a></div>
  <div>&nbsp;&nbsp;<img src="1.gif" tppabs="http://old.peachfuzzer.com/images/1.gif" /><img src="1.gif" tppabs="http://old.peachfuzzer.com/images/1.gif" /><a href="Logger.html" tppabs="http://old.peachfuzzer.com/v3/Logger.html">Loggers</a></div>
  <!-- <div>&nbsp;<img src="/images/1.gif" /><a href="/v3/DebuggingPitFiles.html">Debugging Pits</a></div> -->
  <!-- <div>&nbsp;<img src="/images/1.gif" /><a href="/v3/ValidatingPitFiles.html">Validating Pits</a></div> -->
  <div><img src="1.gif" tppabs="http://old.peachfuzzer.com/images/1.gif" /><a href="RunningPeach.html" tppabs="http://old.peachfuzzer.com/v3/RunningPeach.html">Running</a></div>
  <!-- <div><img src="/images/1.gif" /><a href="/v3/ParallelPeach.html">Parallel</a></div> -->
  <!-- <div><img src="/images/1.gif" /><a href="/v3/ExtendingPeach.html">Extending</a></div> -->
  <div><img src="1.gif" tppabs="http://old.peachfuzzer.com/images/1.gif" /><a href="minset.html" tppabs="http://old.peachfuzzer.com/v3/minset.html">Minset</a></div>

  <div><h5><a href="peach23.html" tppabs="http://old.peachfuzzer.com/v2/peach23.html">Peach 2.3</a></h5></div>

  <div><hr/></div>

  <div><a href="License.html" tppabs="http://old.peachfuzzer.com/License.html">License</a></div>
</div>
</div>
<div id="layout-content-box">
<div id="layout-banner">
  <div id="layout-title">
    <a href="index.htm" tppabs="http://old.peachfuzzer.com/"><img src="peach_fuzzer.png" tppabs="http://old.peachfuzzer.com/images/peach_fuzzer.png" height="100" /></a>
    <a href="javascript:if(confirm(%27http://www.dejavusecurity.com/peach.html  \n\nThis file was not retrieved by Teleport Ultra, because it is addressed on a domain or path outside the boundaries set for its Starting Address.  \n\nDo you want to open it from the server?%27))window.location=%27http://www.dejavusecurity.com/peach.html%27" tppabs="http://www.dejavusecurity.com/peach.html" class="layout-inner-banner-right">
                <img height="50" src="dejavusecurity.png" tppabs="http://old.peachfuzzer.com/images/dejavusecurity.png" /></a>
  </div>

  <div id="layout-description">
  <script>
  (function() {
    var cx = '007028538774543840348:g-0dlrdlmxs';
    var gcse = document.createElement('script'); gcse.type = 'text/javascript'; gcse.async = true;
    gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
        '//www.google.com/cse/cse.js?cx=' + cx;
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(gcse, s);
  })();
</script>
<gcse:search></gcse:search>
      </div>
</div>
<div id="layout-content">
<div id="content">
<div class="sect1">
<h2 id="_relation">Relation</h2>
<div class="sectionbody">
<div class="paragraph"><p>Peach allows modeling of relationships in the data.  Realtionships are things like "X is the size of Y", "X is the count of Y", or "X in the offset (in bytes) of Y".</p></div>
<div class="sect2">
<h3 id="_size_of_relation">Size-of Relation</h3>
<div class="paragraph"><p>In this example the value of the number element will indicate the size of the string element named <em>TheValue</em> in bytes. Note that this also holds true for multi-byte characters such as wchar.  In future versions of Peach either this will change or a new relation of type length will be included so as to better support UTF-8 and other Unicode encodings.</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"32"</span> <span style="color: #009900">signed</span><span style="color: #990000">=</span><span style="color: #FF0000">"false"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
  <span style="font-weight: bold"><span style="color: #0000FF">&lt;Relation</span></span> <span style="color: #009900">type</span><span style="color: #990000">=</span><span style="color: #FF0000">"size"</span> <span style="color: #009900">of</span><span style="color: #990000">=</span><span style="color: #FF0000">"TheValue"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">&lt;/Number&gt;</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"TheValue"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span></tt></pre></div></div>
<div class="paragraph"><p><strong>With expressionGet/expressionSet</strong></p></div>
<div class="paragraph"><p>In this example we will provide two python expressions that allow us to modify the size when it is gotten or set.  Peach makes two variables, <code>self</code> and <code>size</code>, available to us for use in our expressions here.  Self is a reference to the Number element and size is an integer. Expression gets and sets should be each others mathematical inverse. Gets are applied during the cracking process and Sets are applied during the publishing process.</p></div>
<div class="ulist"><ul>
<li>
<p>
<em>expressionGet</em>&#8201;&#8212;&#8201;The result of this expression is used internally and will end up determining how many bytes the <a href="String.html" tppabs="http://old.peachfuzzer.com/v3/String.html">String</a> <em>TheValue</em> reads. If Peach picks up 10 it will internally store a 5 and in turn Peach will read 5 bytes into the string.
</p>
</li>
<li>
<p>
<em>expressionSet</em>&#8201;&#8212;&#8201;Produces a value for the publisher.  In the following example <code>size</code> stored for <em>TheValue</em> will be "5" (length of <em>TheValue</em>) so the value which Peach outputs via a Publisher will be "5*2" or 10.
</p>
</li>
</ul></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"32"</span> <span style="color: #009900">signed</span><span style="color: #990000">=</span><span style="color: #FF0000">"false"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
  <span style="font-weight: bold"><span style="color: #0000FF">&lt;Relation</span></span> <span style="color: #009900">type</span><span style="color: #990000">=</span><span style="color: #FF0000">"size"</span> <span style="color: #009900">of</span><span style="color: #990000">=</span><span style="color: #FF0000">"Value"</span> <span style="color: #009900">expressionGet</span><span style="color: #990000">=</span><span style="color: #FF0000">"size/2"</span> <span style="color: #009900">expressionSet</span><span style="color: #990000">=</span><span style="color: #FF0000">"size*2"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">&lt;/Number&gt;</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"TheValue"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span></tt></pre></div></div>
</div>
<div class="sect2">
<h3 id="_count_of_relation">Count-of Relation</h3>
<div class="paragraph"><p>In this example the number will indicate the count of the array <em>Strings</em>.</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"32"</span> <span style="color: #009900">signed</span><span style="color: #990000">=</span><span style="color: #FF0000">"false"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
  <span style="font-weight: bold"><span style="color: #0000FF">&lt;Relation</span></span> <span style="color: #009900">type</span><span style="color: #990000">=</span><span style="color: #FF0000">"count"</span> <span style="color: #009900">of</span><span style="color: #990000">=</span><span style="color: #FF0000">"Strings"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">&lt;/Number&gt;</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"Strings"</span> <span style="color: #009900">nullTerminated</span><span style="color: #990000">=</span><span style="color: #FF0000">"true"</span> <span style="color: #009900">maxOccurs</span><span style="color: #990000">=</span><span style="color: #FF0000">"1024"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span></tt></pre></div></div>
<div class="paragraph"><p><strong>With expressionGet/expressionSet</strong></p></div>
<div class="paragraph"><p>In this example we will provide two python expressions that will allow us to modify the count when it is gotten or set.  Two variables <code>self</code> and <code>count</code> are made available to us.  Self is a reference to the Number element and count is an integer.  Having <code>count</code> available here is different than in the previous pair of expressions.  While <code>self</code> is always made available in an expression pair, the name of the other variable available to us is the value of the <code>type</code> attribute on our Relation element.</p></div>
<div class="ulist"><ul>
<li>
<p>
<em>expressionGet</em>&#8201;&#8212;&#8201;This value is used internally and will end up determining how many items <a href="String.html" tppabs="http://old.peachfuzzer.com/v3/String.html">String</a> will exand to. Because of the <code>maxOccurs=1024</code> restriction on our recurring strings the max value that Peach should encounter while trying to crack in the <code>CountIndicator</code> element is 2048.
</p>
</li>
<li>
<p>
<em>expressionSet</em>&#8201;&#8212;&#8201;Sets the value that will be produced.  In the following example <code>count</code> will be determined based on how many <a href="String.html" tppabs="http://old.peachfuzzer.com/v3/String.html">String</a> elements are read in.
</p>
</li>
</ul></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"CountIndicator"</span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"32"</span> <span style="color: #009900">signed</span><span style="color: #990000">=</span><span style="color: #FF0000">"false"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
  <span style="font-weight: bold"><span style="color: #0000FF">&lt;Relation</span></span> <span style="color: #009900">type</span><span style="color: #990000">=</span><span style="color: #FF0000">"count"</span> <span style="color: #009900">of</span><span style="color: #990000">=</span><span style="color: #FF0000">"TheValue"</span> <span style="color: #009900">expressionGet</span><span style="color: #990000">=</span><span style="color: #FF0000">"count/2"</span> <span style="color: #009900">expressionSet</span><span style="color: #990000">=</span><span style="color: #FF0000">"count*2"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">&lt;/Number&gt;</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"TheValue"</span> <span style="color: #009900">nullTerminated</span><span style="color: #990000">=</span><span style="color: #FF0000">"true"</span> <span style="color: #009900">maxOccurs</span><span style="color: #990000">=</span><span style="color: #FF0000">"1024"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span></tt></pre></div></div>
</div>
<div class="sect2">
<h3 id="_offset_of_relation">Offset-of Relation</h3>
<div class="paragraph"><p>Offset relations are the latest addition to peach and allow modeling formats that require changing of the offset and also outputting the offset of various elements.Here we have a series elements which are ascii representations of numeric values of the offset sizes to various string elements below.</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">&lt;DataModel</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"TheDataModel"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">length</span><span style="color: #990000">=</span><span style="color: #FF0000">"4"</span> <span style="color: #009900">padCharacter</span><span style="color: #990000">=</span><span style="color: #FF0000">" "</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
                <span style="font-weight: bold"><span style="color: #0000FF">&lt;Relation</span></span> <span style="color: #009900">type</span><span style="color: #990000">=</span><span style="color: #FF0000">"offset"</span> <span style="color: #009900">of</span><span style="color: #990000">=</span><span style="color: #FF0000">"Offset0"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;/String&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">length</span><span style="color: #990000">=</span><span style="color: #FF0000">"4"</span> <span style="color: #009900">padCharacter</span><span style="color: #990000">=</span><span style="color: #FF0000">" "</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
                <span style="font-weight: bold"><span style="color: #0000FF">&lt;Relation</span></span> <span style="color: #009900">type</span><span style="color: #990000">=</span><span style="color: #FF0000">"offset"</span> <span style="color: #009900">of</span><span style="color: #990000">=</span><span style="color: #FF0000">"Offset1"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;/String&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">length</span><span style="color: #990000">=</span><span style="color: #FF0000">"4"</span> <span style="color: #009900">padCharacter</span><span style="color: #990000">=</span><span style="color: #FF0000">" "</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
                <span style="font-weight: bold"><span style="color: #0000FF">&lt;Relation</span></span> <span style="color: #009900">type</span><span style="color: #990000">=</span><span style="color: #FF0000">"offset"</span> <span style="color: #009900">of</span><span style="color: #990000">=</span><span style="color: #FF0000">"Offset2"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;/String&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">length</span><span style="color: #990000">=</span><span style="color: #FF0000">"4"</span> <span style="color: #009900">padCharacter</span><span style="color: #990000">=</span><span style="color: #FF0000">" "</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
                <span style="font-weight: bold"><span style="color: #0000FF">&lt;Relation</span></span> <span style="color: #009900">type</span><span style="color: #990000">=</span><span style="color: #FF0000">"offset"</span> <span style="color: #009900">of</span><span style="color: #990000">=</span><span style="color: #FF0000">"Offset3"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;/String&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">length</span><span style="color: #990000">=</span><span style="color: #FF0000">"4"</span> <span style="color: #009900">padCharacter</span><span style="color: #990000">=</span><span style="color: #FF0000">" "</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
                <span style="font-weight: bold"><span style="color: #0000FF">&lt;Relation</span></span> <span style="color: #009900">type</span><span style="color: #990000">=</span><span style="color: #FF0000">"offset"</span> <span style="color: #009900">of</span><span style="color: #990000">=</span><span style="color: #FF0000">"Offset4"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;/String&gt;</span></span>

        <span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">length</span><span style="color: #990000">=</span><span style="color: #FF0000">"4"</span> <span style="color: #009900">padCharacter</span><span style="color: #990000">=</span><span style="color: #FF0000">" "</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
                <span style="font-weight: bold"><span style="color: #0000FF">&lt;Relation</span></span> <span style="color: #009900">type</span><span style="color: #990000">=</span><span style="color: #FF0000">"offset"</span> <span style="color: #009900">of</span><span style="color: #990000">=</span><span style="color: #FF0000">"Offset5"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;/String&gt;</span></span>

        <span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">length</span><span style="color: #990000">=</span><span style="color: #FF0000">"4"</span> <span style="color: #009900">padCharacter</span><span style="color: #990000">=</span><span style="color: #FF0000">" "</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
                <span style="font-weight: bold"><span style="color: #0000FF">&lt;Relation</span></span> <span style="color: #009900">type</span><span style="color: #990000">=</span><span style="color: #FF0000">"offset"</span> <span style="color: #009900">of</span><span style="color: #990000">=</span><span style="color: #FF0000">"Offset6"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;/String&gt;</span></span>

        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Block&gt;</span></span>
                <span style="font-weight: bold"><span style="color: #0000FF">&lt;Block</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"Offset0"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
                        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Block&gt;</span></span>
                                <span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"Offset1"</span> <span style="color: #009900">value</span><span style="color: #990000">=</span><span style="color: #FF0000">"CRAZY STRING!"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
                                <span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">value</span><span style="color: #990000">=</span><span style="color: #FF0000">"aslkjalskdjas"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
                                <span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">value</span><span style="color: #990000">=</span><span style="color: #FF0000">"aslkdjalskdjasdkjasdlkjasd"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
                        <span style="font-weight: bold"><span style="color: #0000FF">&lt;/Block&gt;</span></span>
                        <span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"Offset2"</span> <span style="color: #009900">value</span><span style="color: #990000">=</span><span style="color: #FF0000">"ALSKJDALKSJD"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
                        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Block&gt;</span></span>
                                <span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"Offset3"</span> <span style="color: #009900">value</span><span style="color: #990000">=</span><span style="color: #FF0000">"1"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
                                <span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"Offset4"</span> <span style="color: #009900">value</span><span style="color: #990000">=</span><span style="color: #FF0000">""</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
                                <span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"Offset5"</span> <span style="color: #009900">value</span><span style="color: #990000">=</span><span style="color: #FF0000">"1293812093"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
                        <span style="font-weight: bold"><span style="color: #0000FF">&lt;/Block&gt;</span></span>
                <span style="font-weight: bold"><span style="color: #0000FF">&lt;/Block&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;/Block&gt;</span></span>

        <span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"Offset6"</span> <span style="color: #009900">value</span><span style="color: #990000">=</span><span style="color: #FF0000">"aslkdjalskdjas"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>

<span style="font-weight: bold"><span style="color: #0000FF">&lt;/DataModel&gt;</span></span></tt></pre></div></div>
<div class="paragraph"><p><strong>Relative Offset</strong></p></div>
<div class="paragraph"><p>Starting with Peach 2.3 we also support the concept of relative offsets.  A relative offset is from the data element the relation is attached to.  Consider the following example.  When determining the offset of <em>StringData</em> Peach will add/subtract the position of <em>OffsetToString</em> to it&#8217;s value as needed to determine the correct offset.</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>
<span style="font-style: italic"><span style="color: #9A1900">&lt;!-- Other data elements precede --&gt;</span></span>

<span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"OffsetToString"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
   <span style="font-weight: bold"><span style="color: #0000FF">&lt;Relation</span></span> <span style="color: #009900">type</span><span style="color: #990000">=</span><span style="color: #FF0000">"offset"</span> <span style="color: #009900">of</span><span style="color: #990000">=</span><span style="color: #FF0000">"StringData"</span> <span style="color: #009900">relative</span><span style="color: #990000">=</span><span style="color: #FF0000">"true"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">&lt;/Number&gt;</span></span>

<span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"StringData"</span> <span style="color: #009900">nullTerminated</span><span style="color: #990000">=</span><span style="color: #FF0000">"true"</span><span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span></tt></pre></div></div>
<div class="paragraph"><p><strong>Relative To Offset</strong></p></div>
<div class="paragraph"><p>Peach also supports offsets that are relative to another element.  This is used when an element contains the offset to another element from the start of, say, a structure.  In the following example the offset of <em>StringData</em> will be calculated by adding the value of <em>OffsetToString</em> to the position of <em>Structure</em>.</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">&lt;Block</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"Structure"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
   <span style="font-style: italic"><span style="color: #9A1900">&lt;!-- Other data elements precede --&gt;</span></span>

   <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"OffsetToString"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
      <span style="font-weight: bold"><span style="color: #0000FF">&lt;Relation</span></span> <span style="color: #009900">type</span><span style="color: #990000">=</span><span style="color: #FF0000">"offset"</span> <span style="color: #009900">of</span><span style="color: #990000">=</span><span style="color: #FF0000">"StringData"</span> <span style="color: #009900">relative</span><span style="color: #990000">=</span><span style="color: #FF0000">"true"</span> <span style="color: #009900">relativeTo</span><span style="color: #990000">=</span><span style="color: #FF0000">"Structure"</span> <span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
   <span style="font-weight: bold"><span style="color: #0000FF">&lt;/Number&gt;</span></span>

   <span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"StringData"</span> <span style="color: #009900">nullTerminated</span><span style="color: #990000">=</span><span style="color: #FF0000">"true"</span><span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">&lt;/Structure&gt;</span></span></tt></pre></div></div>
<div class="paragraph"><p><strong>With expressionGet/expressionSet</strong></p></div>
<div class="paragraph"><p>When using expressionGet/Set with offset relations two variables are provided: self, and offset.  self is a reference to the parent element of the reference, and offset is an integer.</p></div>
<div class="paragraph"><p><strong>Offset Relation with Placement</strong></p></div>
<div class="paragraph"><p>In this model we will use a typical patter in which an array of offsets gives us the location of another element. We will use the <a href="Placement.html" tppabs="http://old.peachfuzzer.com/v3/Placement.html">Placement</a> element to move the created <em>Data</em> strings to after our block called <em>Chunks</em>.</p></div>
<div class="admonitionblock">
<table><tr>
<td class="icon">
<div class="title">Note</div>
</td>
<td class="content">Placement only works when parsing data into a DataModel.  Read <a href="Placement.html" tppabs="http://old.peachfuzzer.com/v3/Placement.html">Placement</a> for more information.</td>
</tr></table>
</div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">&lt;DataModel</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"TheDataModel"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
  <span style="font-weight: bold"><span style="color: #0000FF">&lt;Block</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"Chunks"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;Block</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"ArrayOfChunks"</span> <span style="color: #009900">maxOccurs</span><span style="color: #990000">=</span><span style="color: #FF0000">"4"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
      <span style="font-weight: bold"><span style="color: #0000FF">&lt;Number</span></span> <span style="color: #009900">size</span><span style="color: #990000">=</span><span style="color: #FF0000">"8"</span> <span style="color: #009900">signed</span><span style="color: #990000">=</span><span style="color: #FF0000">"false"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Relation</span></span> <span style="color: #009900">type</span><span style="color: #990000">=</span><span style="color: #FF0000">"offset"</span> <span style="color: #009900">of</span><span style="color: #990000">=</span><span style="color: #FF0000">"Data"</span><span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
      <span style="font-weight: bold"><span style="color: #0000FF">&lt;/Number&gt;</span></span>
      <span style="font-weight: bold"><span style="color: #0000FF">&lt;String</span></span> <span style="color: #009900">name</span><span style="color: #990000">=</span><span style="color: #FF0000">"Data"</span> <span style="color: #009900">length</span><span style="color: #990000">=</span><span style="color: #FF0000">"6"</span><span style="font-weight: bold"><span style="color: #0000FF">&gt;</span></span>
        <span style="font-weight: bold"><span style="color: #0000FF">&lt;Placement</span></span> <span style="color: #009900">after</span><span style="color: #990000">=</span><span style="color: #FF0000">"Chunks"</span><span style="font-weight: bold"><span style="color: #0000FF">/&gt;</span></span>
      <span style="font-weight: bold"><span style="color: #0000FF">&lt;/String&gt;</span></span>
    <span style="font-weight: bold"><span style="color: #0000FF">&lt;/Block&gt;</span></span>
  <span style="font-weight: bold"><span style="color: #0000FF">&lt;/Block&gt;</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">&lt;/DataModel&gt;</span></span></tt></pre></div></div>
</div>
</div>
</div>
</div>
<div id="footnotes"></div>
<div id="footer">
<div id="footer-text">

<table width="100%">
<td><td>
<a href="javascript:if(confirm(%27http://dejavusecurity.com/  \n\nThis file was not retrieved by Teleport Ultra, because it is addressed on a domain or path outside the boundaries set for its Starting Address.  \n\nDo you want to open it from the server?%27))window.location=%27http://dejavusecurity.com/%27" tppabs="http://dejavusecurity.com/"><img src="dejavusecurity.png" tppabs="http://old.peachfuzzer.com/images/dejavusecurity.png" height="50"/></a>
</td><td>&nbsp;&nbsp;&nbsp;</td><td>

Copyright (c) <a href="javascript:if(confirm(%27http://dejavusecurity.com/  \n\nThis file was not retrieved by Teleport Ultra, because it is addressed on a domain or path outside the boundaries set for its Starting Address.  \n\nDo you want to open it from the server?%27))window.location=%27http://dejavusecurity.com/%27" tppabs="http://dejavusecurity.com/">Deja vu Security</a> <br/>
Last updated 2014-02-23 21:24:07 PST
</td>
</table>

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-1094513-10']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www/') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>
</div>
</div>
</div>
</div>
</body>
</html>
